<?php
require_once(dirname(dirname(__FILE__))."/config.php");
require_once(dirname(dirname(__FILE__))."/smarty_config.php");

$files = glob(dirname(dirname(__FILE__)).'/classes/*.php');
foreach ($files as $file) {
    require_once($file);   
}
$system = new System();

$logged=false;
if(isset($_COOKIE['admin_cookie_user']) && isset($_COOKIE['admin_cookie_hashcode'])){
	if(count($sql->QueryGetFetch("SELECT * FROM `uzytkownicy` WHERE `login`='".$_COOKIE['admin_cookie_user']."' AND `hash_code`='".($_COOKIE['admin_cookie_hashcode'])."'"))){
		$logged = true;
		$k = $sql->QueryGetFetch("SELECT * FROM `uzytkownicy` WHERE `login`='".$_COOKIE['admin_cookie_user']."' AND `hash_code`='".($_COOKIE['admin_cookie_hashcode'])."'");
		$logged_user_id = $k[0]['id']; //
	}
}


define("LOGGED",$logged);
$smarty->assign('system',$system);
$smarty->assign("host",$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF']));
$smarty->assign("_LOGGED",$logged);
//$quiz->openTxt("./quiz.txt");
?>